let rec sort lst = match lst with
  [] -> []
| head :: tail -> insert head (sort tail)
and insert elt lst =  match lst with
  [] -> [elt]
| head :: tail -> if elt <= head then elt :: lst else head :: insert elt tail
;;

let l = ["is";  "a"; "tale"; "told"; "etc."];;

let rec eqlist xs ys = match (xs, ys) with
  ([], []) -> true
| (x::xs, y::ys) -> if x = y then eqlist xs ys else false
| _ -> false
;;

if eqlist (sort l) ["a"; "etc."; "is" ;"tale"; "told"] then 
  print_string "[is; a; tale; told; etc.] -> [a; etc.; is ;table; told]\n\
Yes!\n"
else
  assert false
;;

